package com.free.semantic.infrastruct.mapper;

import com.free.semantic.infrastruct.common.ModelMarketDO;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 模型市场Mapper接口
 */
@Mapper
public interface ModelMarketMapper {
    
    @Select("SELECT * FROM model_market WHERE id = #{id}")
    ModelMarketDO findById(@Param("id") Long id);
    
    @Select("SELECT * FROM model_market")
    List<ModelMarketDO> findAll();
    
    @Insert("INSERT INTO model_market(name, description, create_time, update_time) " +
            "VALUES(#{name}, #{description}, NOW(), NOW())")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insert(ModelMarketDO modelMarketDO);
    
    @Update("UPDATE model_market SET name = #{name}, description = #{description}, " +
            "update_time = NOW() WHERE id = #{id}")
    int update(ModelMarketDO modelMarketDO);
    
    @Delete("DELETE FROM model_market WHERE id = #{id}")
    int deleteById(@Param("id") Long id);
} 